<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>递归</title>
</head>
<body>
        <script>
            function foo(num) {

                  console.log(num);
                if(num==1){
                  return 1;
              }else{
                    return  num + foo(num-1);            //3+((2+1)+1)
                }
            }
           console.log(foo(100))

        </script>
</body>
</html>